package ooday04;

import java.util.Timer;
import java.util.TimerTask;

public class TimerDemo {
    public static void main(String[] args) {
        Timer timer =new Timer();
        int time=1000;
        timer.schedule(new TimerTask() {
            public void run() {
                System.out.println("该学习了");
            }
        },time,time);

        /*Timer timer = new Timer();//定时器单位
        int interval = 1000;//定时器间隔（以毫秒为单位）
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("123123123");
            }
        }, 5000, 5000);*/






    }



}
